if (!window.Patch) {
    window.Patch = {};
}

if (!Patch.trigger_event) {
    Patch.trigger_event = (function ($) {
        return function (src, name) {
            var events, self = $(src), options = self.data ('settings'), a, i, j = name.indexOf ('.');
            if (j >= 0) {
                name = name.substr (0, j);
            }

            if (options && (name in options) && (typeof options[name] === 'function')) {
                return options [name].apply (src);
            } else {
                events = $._data (self[0]);
                if (events && ('events' in events) && (name in (events = events ['events']))) {
                    a = events [name];
                    if (a.length) {
                        for (i = 0; i < a.length; i ++) {
                            if (a[i].handler) {
                                return a[i].handler.apply (src);
                            }
                        }
                    }
                }
            }
        }
    })(jQuery);
}

if (!Patch.get_css_number_property) {
    Patch.get_css_number_property = (function ($) {
        return function (src, prop) {
            var n = $(src).css (prop);
            if (n) {
                n = parseFloat (n);
                if (n) {
                    return n;
                }
            }

            return 0;
        }
    })(jQuery);
}